using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using EngineGame;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace WarsOnRiceFields
{
    public class Logo: GameScreen
    {
        private Sprite bgrSprite;
        private Thread thread;
        private int count = 0;
        public Logo()
        {
            thread = new Thread(new ThreadStart(Count));
            thread.Start();
        }
        private void Count()
        {
            Thread.Sleep(3000);
            count++;
        }
        public override void LoadContent()
        {
            bgrSprite = new Sprite(ScreenManager.Game.Content, "Images/logo");
            base.LoadContent();
        }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            thread.Join();
            if (count > 0)
            {
                thread = null;
                this.ExitScreen();
                ScreenManager.AddScreen(new Menu());
                ScreenManager.Game.ResetElapsedTime();
            }
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin();
            bgrSprite.Draw(ScreenManager.SpriteBatch);
            ScreenManager.SpriteBatch.End();
            base.Draw(gameTime);
        }
    }
}
